package com.at.spring;

import com.at.spring.Bean.Vip;
import com.at.spring.Service.VipService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.List;

@MapperScan(basePackages = {"com.at.spring.respository"})
@SpringBootApplication
public class SpringgggApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringgggApplication.class, args);
        VipService bean = applicationContext.getBean(VipService.class);
        Vip vip1 = new Vip("jack", "1234567899", "1999-10-11");
        bean.save(vip1);

        Vip vip2 = new Vip("lucy", "6666666", "1999-10-11");
        bean.save(vip2);

        bean.findAll().forEach(System.out::println);
        applicationContext.close();
    }

}
